package threading;

public class ThreadDemo17 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            //得到当前线程
            Thread cThread = Thread.currentThread();
            for (int i = 0; i < 100; i++) {
                //让出CPU执行权
                Thread.yield();
                System.out.println("执行线程：" + cThread.getName());
            }
        },"张三");

        t1.start();

        new Thread(()->{
            Thread cThread = Thread.currentThread();
            for (int i = 0; i < 100; i++) {
                System.out.println("执行线程：" + cThread.getName());
            }
        },"李四").start();
    }
}
